package io.github.lingalone.monsterauth.auth;


import io.github.lingalone.monsterauth.domain.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

/**
 * Created with IntelliJ IDEA.
 *
 * @author <a href="https://github.com/lingalone">lingalone</a>
 * @version 1.0.0
 * @link
 * @since 2018/7/24
 */
@Service
public class AuthUserDetailService implements UserDetailsService {
    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        // load from database
        User user = new User();
        user.setUsername(username);
        user.setPassword("$2a$10$BXT1OSTHI/6Hy69f/JFXbuK5XTnZ38BTedE0BkaCaFweitAsr7TYi");
        return new AuthUserDetails(user);
    }
}
